package controllers;

import java.util.List;

import models.Post;
import play.Play;
import play.mvc.Before;
import play.mvc.Controller;


public class Application extends Controller {
	
	@Before
	static void addDefaults() {
	    renderArgs.put("blogTitle", Play.configuration.getProperty("blog.title"));
	    renderArgs.put("blogBaseline", Play.configuration.getProperty("blog.baseline"));
	}
	
	public static void index() {
		List<Post> posts = Post.find("order by postedAt desc").fetch(12);
        render(posts);
	}
	
	public static void show(Long id) {
	    Post post = Post.findById(id);
        render(post);
	}

}